<?php
namespace Tbf\Bundle\TestBundle\SetUp;
use Symfony\Component\Yaml\Yaml;
use Tbf\Bundle\TbfBundle\DependencyInjection\TbfContainerAware;

class SetupManager extends TbfContainerAware{
    /** @var SetupCollection  */
    protected $setup_collection;
    /**
     * @var
     */
    protected $setup_type;
    function __construct(SetupCollection $setup_collection){
        $this->setup_collection = $setup_collection;
    }
    function runSetup($name){
        if (!$this->setup_collection->has($name)){
            throw new \Exception(sprintf('you request setup name %s not register',$name));
        }
        $deps = $this->setup_collection->resolveDepsByName($name);
        foreach($deps as $dep){
            $this->setup_collection->get($dep)->doSetUp($this->container);
        }
        $this->setup_collection->get($name)->doSetUp($this->container);
    }

    function registerSetupType($name,$class_name){

    }
}